﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SharingCenter.Web.Classes;

namespace SharingCenter.Web.Shared
{
    public partial class Site : System.Web.UI.MasterPage, ITemplateManupulation
    {
        string navName;

        protected void Page_Init(object sender, EventArgs e)
        {
            ScriptManager1.AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(ScriptManager1_AsyncPostBackError);
        }

        void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
        {
            ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            //Sidebar1.SelectedTab = this.Attributes["nav"].ToLower();
            try
            {
                if (Convert.ToBoolean(Session["PAGE_UPDATED"]))
                {
                    if (Session["TOP_MOST_MESSAGE"] != null)
                    {
                        lblLoading.CssClass += " showonload";
                        lblLoading.Text = Session["TOP_MOST_MESSAGE"].ToString();
                        Session["TOP_MOST_MESSAGE"] = null;
                    }
                    else
                    {
                        lblLoading.Visible = false;
                    }
                    Session["PAGE_UPDATED"] = false;
                }
            }
            catch { }
        }

        #region ITemplateManupulation Members

        public void SetNavName(string name)
        {
            navName = name;
        }

        public string GetNavName()
        {
            return navName;
        }

        public void SetOverrideSiteMapPath(bool ifOverride)
        {
            //SiteMapPath1.Visible = !ifOverride;
        }

        #endregion
    }
}
